package com.pcbly.web.persistence.timesheet;
 
import com.pcbly.web.components.utils.random.GUID;
import com.pcbly.web.bean.timesheet.TimesheetExecutionBean;
import com.pcbly.web.persistence.HibernateBaseDao;
 
public class TimesheetExecutionHibernateDao extends HibernateBaseDao<TimesheetExecutionBean> implements TimesheetExecutionDao {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7383261425958185672L;
	protected Class<TimesheetExecutionBean> getEntityClass() {
		return TimesheetExecutionBean.class;
	}

	public TimesheetExecutionHibernateDao() {
		super();
	}
	@Override 
	public void saveTimesheetExecutionBean(TimesheetExecutionBean timesheet) throws Exception{
		if(logger.isDebugEnabled()){
			logger.debug(timesheet.getId());
		}
		String id=(new GUID()).toString();
		timesheet.setId(id);
		getHibernateTemplate().save(timesheet);
	}
	@Override
	public void removeTimesheetExecutionBeanByIds(String ids) throws Exception {
		// TODO Auto-generated method stub
		ids = ids.replaceAll(",", "','");
		String hsql = "delete from t_timesheet_execution where ID in( '" + ids + "')";
		getSession().createSQLQuery(hsql).executeUpdate();
		
	}
}